﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.Data.OracleClient;
using ReflectionStudio.Core.Events;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using System.Threading;
using System.Windows.Input;
using ExThreading;
using ReflectionStudio.Core;
using System.ComponentModel;
using ReflectionStudio.Core.Database;
using System.IO;
using System.Security;
using System.Data.SqlClient;
namespace WPFExcelReport
{
    public partial class BaseFunction 
    {
        public SqlConnection SqlServerDB;
        public DataSet Connect2Proxy(OracleCommand oracmd)
        {
            DataSet dsResult = new DataSet();
            try
            {
                dicQueryParamater.Clear();
                dicQueryParamater.Add("CommandText", oracmd.CommandText);
                dicQueryParamater.Add("CommandType", oracmd.CommandType.ToString());
                dicQueryParamater.Add("ConnectionString", oracmd.Connection.ConnectionString);
                foreach (OracleParameter cmp in oracmd.Parameters)
                {
                    dicQueryParamater.Add(cmp.ParameterName.ToString(), cmp.Value.ToString());
                }
                dsResult = proxy.GetDataSetByQuery(dicQueryParamater);
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            return dsResult;
        }
        public DataSet Connect2Proxy(SqlCommand sqlcommand)
        {
            DataSet dsResult = new DataSet();
            try
            {
                dicQueryParamater.Clear();
                dicQueryParamater.Add("DBTYPE", "SQLSERVER");
                dicQueryParamater.Add("CommandText", sqlcommand.CommandText);
                dicQueryParamater.Add("CommandType", sqlcommand.CommandType.ToString());
                dicQueryParamater.Add("ConnectionString", sqlcommand.Connection.ConnectionString);
                foreach (SqlParameter cmp in sqlcommand.Parameters)
                {
                    dicQueryParamater.Add(cmp.ParameterName.ToString(), cmp.Value.ToString());
                }
                dsResult = proxy.GetDataSetByQuery(dicQueryParamater);
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            return dsResult;
        }
    }
}
